const express = require('express');
const bodyParser = require('body-parser');
const path = require('path');
const homeRouter = require('./routes/home');
const newsRouter = require('./routes/news')
const app = express();

// 解析post请求参数
app.use(bodyParser.urlencoded({extended:false}));
app.use(bodyParser.json())
// 静态资源中间件
app.use('/static', express.static(path.join(__dirname,'public')));

// 使用路由
app.use(homeRouter);
app.use(newsRouter);
app.listen(3000, ()=>{ console.log('start at port 3000') });